<?php



class important extends connector {

	function important() {
		$this->softbase(true);
	}

	function ontypelist() {
		$this->powercheck(71, 72);
		parent::start_template();

		$MinPageid = $this->fun->accept('MinPageid', 'R');

		$page_id = $this->fun->accept('page_id', 'R');

		$countnum = $this->fun->accept('countnum', 'R');

		$MaxPerPage = $this->fun->accept('MaxPerPage', 'R');
		if (empty($MaxPerPage)) {
			$MaxPerPage = $this->CON['max_list'];
		}
		$db_table = db_prefix . 'typelist';

		$lng = $this->fun->accept('lng', 'R');
		$lng = empty($lng) ? ($this->CON['is_alonelng'] && !empty($this->CON['home_lng'])) ? $this->CON['home_lng'] : $this->CON['default_lng'] : $lng;
		if (!empty($lng)) {
			$db_where = ' WHERE c.lng=\'' . $lng . '\'';
		} else {
			$db_where = ' WHERE c.lng=\'' . $this->CON['default_lng'] . '\'';
		}
		$mid = $this->fun->accept('mid', 'R');
		if (!empty($mid)) {
			$db_where.=' AND c.mid=' . $mid;
		}

		$isclass = intval($this->fun->accept('isclass', 'R'));
		if (!empty($isclass)) {
			if ($isclass == 2) {
				$isclass = 0;
			}
			$db_where.=' AND c.isclass=' . $isclass;
		}

		if (!empty($countnum)) {
			$numsql = 'SELECT COUNT(*) AS num FROM ' . $db_table . ' AS c ' . $db_where;
			$resulted = $this->db->query($numsql);
			$resulted = $this->db->fetch_assoc($resulted);
			exit($resulted['num']);
		}


		$limitkey = $this->fun->accept('limitkey', 'R');
		$limitkey = empty($limitkey) ? 'c.pid' : $limitkey;

		$limitclass = $this->fun->accept('limitclass', 'R');
		$limitclass = empty($limitclass) ? 'ASC' : $limitclass;


		$sql = 'SELECT c.tid,c.pid,c.mid,c.topid,c.upid,c.exmid,c.lng,c.typename,c.typepic,c.dirname,c.width,c.height,c.purview,c.ismenu,c.isaccessory,c.isclass,c.ispart,c.styleid,c.pageclass,c.template,c.readtemplate,c.filenamestyle,c.dirpath,c.isdatadir,c.addtime,COUNT(a.tid) AS has_c
		FROM ' . $db_table . ' AS c LEFT JOIN ' . $db_table . ' AS a ON a.upid = c.tid' . $db_where . ' GROUP BY c.tid ORDER BY c.upid,' . $limitkey . ' ' . $limitclass;
		$rs = $this->db->query($sql);
		while ($rsList = $this->db->fetch_assoc($rs)) {
			$puvname = $this->get_member_purview($rsList['purview'], 'rankname');
			$modelname = $this->get_modelview($rsList['mid'], 'modelname');
			$rsList['glink'] = $this->get_link('type', $rsList, $rsList['lng']);
			$rsList['puvname'] = empty($puvname) ? $this->lng['puv_no'] : $puvname;
			$rsList['modelname'] = $modelname;
			$t_array[] = $rsList;
		}

		if (is_array($t_array)) {
			$typelist = $this->get_typelist($t_array, $mid, 0, 0, $lng);
			unset($t_array);
			$i = 0;
			$newarray = array();
			$endpage = $MinPageid + $MaxPerPage;
			foreach ($typelist as $key => $value) {

				if (( $i >= $MinPageid ) && ($endpage > $i)) {
					$newarray[] = $value;
				}
				if ($endpage < $i) break;
				$i++;
			}
			unset($typelist);
		}
		unset($this->CON, $this->lng);
		$this->ectemplates->assign('array', $newarray);
		$this->ectemplates->assign('sql', $sql);
		$this->ectemplates->display('article/type_list');
	}

	function ontypeadd() {
		$this->powercheck(71, 73);
		include_once admin_ROOT . adminfile . '/include/command_templatesdir.php';
		parent::start_template();
		$tab = $this->fun->accept('tab', 'G');
		$tab = empty($tab) ? 'true' : $tab;

		$upid = $this->fun->accept('upid', 'G');
		$upid = empty($upid) ? 0 : $upid;

		$topid = $this->fun->accept('topid', 'G');
		$topid = empty($topid) ? $upid : $topid;
		$lng = $this->fun->accept('lng', 'G');
		$lng = empty($lng) ? ($this->CON['is_alonelng'] && !empty($this->CON['home_lng'])) ? $this->CON['home_lng'] : $this->CON['default_lng'] : $lng;

		$lnglist = $this->get_lng_array($lng);
		$this->ectemplates->assign('lnglist', $lnglist['list']);

		$memberpuv = $this->get_member_purview_array();
		$this->ectemplates->assign('memberpuvlist', $memberpuv['list']);

		$keytypearray = $this->get_keytype_array(0, $lng);
		$this->ectemplates->assign('keyarray', $keytypearray['list']);

		$typeaddinfo = explode('|', $this->fun->eccode($this->fun->accept('esp_typeaddinfo', 'C'), 'DECODE', db_pscode));
		if (!empty($typeaddinfo) && is_array($typeaddinfo)) {
			$typeaddinfo['template'] = $typeaddinfo[0];
			$typeaddinfo['readtemplate'] = $typeaddinfo[1];
			$typeaddinfo['filenamestyle'] = $typeaddinfo[2];
			$typeaddinfo['readnamestyle'] = $typeaddinfo[3];
		}

		if (!empty($upid)) {
			$typeread = $this->get_type($upid);
		}
		$mid = !empty($typeread['mid']) ? $typeread['mid'] : 0;

		$modelarray = $this->get_model($mid, $lng, 1);
		$this->ectemplates->assign('modelarray', $modelarray['list']);

		$this->ectemplates->assign('typeaddinfo', $typeaddinfo);
		$this->ectemplates->assign('typread', $typeread);
		$this->ectemplates->assign('tab', $tab);
		$this->ectemplates->assign('tempname', $TEMPNAMELIST);
		$this->ectemplates->assign('upid', $upid);
		$this->ectemplates->assign('topid', $topid);
		$this->ectemplates->assign('lng', $lng);
		$this->ectemplates->display('article/type_add');
	}

	function ontypeedit() {
		include_once admin_ROOT . adminfile . '/include/command_templatesdir.php';
		parent::start_template();
		$this->powercheck(71, 96);
		$db_table = db_prefix . 'typelist';
		$type = $this->fun->accept('type', 'G');
		$tid = intval($this->fun->accept('tid', 'G'));
		$db_where = 'tid=' . $tid;
		$typeread = $this->db->fetch_first('SELECT * FROM ' . $db_table . ' WHERE ' . $db_where);
		if ($typeread['upid'] > 0) {

			$typelist = $this->get_typeselect(0, 0, $typeread['upid'], $typeread['lng'], 0, 1);
			$this->ectemplates->assign('typelist', $typelist);
		}

		$memberpuv = $this->get_member_purview_array($typeread['purview']);
		$this->ectemplates->assign('memberpuvlist', $memberpuv['list']);

		$keytypearray = $this->get_keytype_array(0, $lng);
		$this->ectemplates->assign('keyarray', $keytypearray['list']);

		$model = $this->get_modelview($typeread['mid'], 'modelname');
		$this->ectemplates->assign('model', $model);
		$this->ectemplates->assign('pathdir', $this->CON['file_htmldir']);
		$this->ectemplates->assign('tab', 'true');
		$this->ectemplates->assign('typeread', $typeread);
		$this->ectemplates->assign('type', $type);
		$this->ectemplates->assign('is_alonelng', $this->CON['is_alonelng']);
		$this->ectemplates->assign('tempname', $TEMPNAMELIST);
		$this->ectemplates->display('article/type_edit');
	}

	function ontypeshift() {
		parent::start_template();
		$db_table = db_prefix . 'typelist';
		$type = $this->fun->accept('type', 'G');
		$tid = intval($this->fun->accept('tid', 'G'));
		$db_where = 'tid=' . $tid;
		$typeread = $this->db->fetch_first('SELECT * FROM ' . $db_table . ' WHERE ' . $db_where);

		$typelist = $this->get_typeselect(0, 0, $typeread['upid'], $typeread['lng'], 0, 1);
		$this->ectemplates->assign('typelist', $typelist);

		$model = $this->get_modelview($typeread['mid'], 'modelname');
		$this->ectemplates->assign('model', $model);
		$this->ectemplates->assign('tab', 'true');
		$this->ectemplates->assign('typeread', $typeread);
		$this->ectemplates->assign('type', $type);
		$this->ectemplates->display('article/type_shift');
	}

	function ontypesave() {
		include_once admin_ROOT . adminfile . '/include/command_templatesdir.php';
		include_once admin_ROOT . 'public/class_pingying.php';
		parent::start_template();
		$inputclass = $this->fun->accept('inputclass', 'P');
		$inputupid = $this->fun->accept('inputupid', 'P');
		$lng = $this->fun->accept('lng', 'P');
		$lng = empty($lng) ? $this->CON['default_lng'] : $lng;
		$mid = $this->fun->accept('mid', 'P');
		$mid = empty($mid) ? 0 : $mid;
		$upid = $this->fun->accept('upid', 'P');
		$topid = $this->fun->accept('topid', 'P');
		$typename = $this->fun->accept('typename', 'P');
		$content = $this->fun->accept('content', 'P');
		$keywords = $this->fun->accept('keywords', 'P');
		$description = $this->fun->accept('description', 'P');
		$typepic = $this->fun->accept('typepic', 'P');
		$dirname = $this->fun->accept('dirname', 'P');
		$width = $this->fun->accept('width', 'P');
		$width = empty($width) ? 0 : $width;
		$height = $this->fun->accept('height', 'P');
		$height = empty($height) ? 0 : $height;
		$purview = $this->fun->accept('purview', 'P');
		$purview = empty($purview) ? 0 : $purview;
		$ismenu = $this->fun->accept('ismenu', 'P');
		$ismenu = empty($ismenu) ? 0 : $ismenu;
		$isaccessory = $this->fun->accept('isaccessory', 'P');
		$isaccessory = empty($isaccessory) ? 0 : $isaccessory;
		$isdirname = $this->fun->accept('isdirname', 'P');
		$isdirname = empty($isdirname) ? 0 : $isdirname;
		$styleid = $this->fun->accept('styleid', 'P');
		$pageclass = $this->fun->accept('pageclass', 'P');
		$pageclass = empty($pageclass) ? 0 : $pageclass;
		$ispart = $this->fun->accept('ispart', 'P');
		$ispart = empty($ispart) ? 0 : $ispart;

		$template = $this->fun->accept('template', 'P');
		if (empty($template)) {
			$template = ($styleid == 1) ? $TEMPNAMELIST['typeindex'] : $TEMPNAMELIST['typelist'];
		}
		$readtemplate = $this->fun->accept('readtemplate', 'P');
		$readtemplate = empty($readtemplate) ? $TEMPNAMELIST['typeread'] : $readtemplate;
		$filenamestyle = $this->fun->accept('filenamestyle', 'P');
		$readnamestyle = $this->fun->accept('readnamestyle', 'P');
		$isdatadir = $this->fun->accept('isdatadir', 'P');
		$typeurl = $this->fun->accept('typeurl', 'P');
		$db_table = db_prefix . 'typelist';
		$date = time();
		if ($inputclass == 'add') {
			$this->powercheck(71, 73);

			$infosavae_array = "$template|$readtemplate|$filenamestyle|$readnamestyle";
			$this->fun->setcookie("esp_typeaddinfo", $this->fun->eccode($infosavae_array, 'ENCODE', db_pscode), 2592000);
			if ($isdirname) {

				$chinesespelit = new chineseSpell();
				$dirname = $chinesespelit->getFullSpell($typename);
			} else {
				if (!preg_match("/^[\w-]+$/i", $dirname)) {
					exit($this->lng['typemanage_js_dirname_empty']);
				}
			}

			if (!$upid) {
				$db_where = " WHERE upid=0 AND dirname='$dirname' AND lng='$lng'";
			} else {
				$db_where = " WHERE topid=$topid AND dirname='$dirname' AND lng='$lng'";
			}
			$countnum = $this->db_numrows($db_table, $db_where);
			if (!$isdirname) {
				if ($countnum > 0) {
					exit($this->lng['typemanage_js_type_dirname_check_no']);
				}
			} else {
				$dirname = $countnum > 0 ? $dirname . mt_rand(10, 99) : $dirname;
			}

			if (!$upid) {
				$db_where2 = " WHERE dirname='$dirname' AND lng='$lng'";
				$db_table2 = db_prefix . 'subjectlist';
				$countnum = $this->db_numrows($db_table2, $db_where2);
				if (!$isdirname) {
					if ($countnum > 0) {
						exit($this->lng['typemanage_js_type_dirname_check_no']);
					}
				} else {
					$dirname = $countnum > 0 ? $dirname . mt_rand(10, 99) : $dirname;
				}
			}

			$typepath = admin_ROOT . $this->CON['file_htmldir'];
			if (!$this->fun->filemode($typepath)) {
				exit($this->lng['filedir_err'] . '(' . $this->CON['file_htmldir'] . ')');
			}

			if ($upid == 0) {
				if ($this->CON['is_alonelng']) {
					$typedir = $typepath . $dirname;
				} else {
					$typedir = $typepath . $lng . '/' . $dirname;
				}
				$dirpath = $dirname;
				$topid = 0;
				$exmid = 0;
			} else {

				$topid_read = $this->get_type($topid);

				$exmid = ($topid_read['mid'] != $mid) ? $topid_read['mid'] : 0;

				$topid_temp = $topid_read['dirname'];

				if ($this->CON['is_alonelng']) {
					$typedir = $typepath . $topid_temp . '/' . $dirname;
				} else {
					$typedir = $typepath . $lng . '/' . $topid_temp . '/' . $dirname;
				}
				$dirpath = $topid_temp . '/' . $dirname;
			}
			if (!is_dir($typedir)) {
				if (!@mkdir($typedir, 0777, true)) exit($this->lng['filedircreat_err'] . '(' . $this->CON['file_htmldir'] . ')');
			}
			$db_field = 'pid,mid,topid,upid,exmid,lng,typename,content,keywords,description,typepic,dirname,width,height,purview,ismenu,isaccessory,isclass,ispart,styleid,pageclass,template,readtemplate,filenamestyle,readnamestyle,typeurl,dirpath,isdatadir,addtime';
			$db_values = "50,$mid,$topid,$upid,$exmid,'$lng','$typename','$content','$keywords','$description','$typepic','$dirname',$width,$height,$purview,$ismenu,$isaccessory,1,$ispart,$styleid,$pageclass,'$template','$readtemplate','$filenamestyle','$readnamestyle','$typeurl','$dirpath',$isdatadir,$date";
			$this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')');
			$this->writelog($this->lng['typemanage_add_log'], $this->lng['log_extra_ok'] . ' typename=' . $typename);
			$this->dbcache->clearcache('typelist_array', true);
			exit('true');
		}elseif ($inputclass == 'edit') {
			$this->powercheck(71, 96);
			$tid = $this->fun->accept('tid', 'P');
			$topid = $this->fun->accept('topid', 'P');
			$topid = empty($topid) ? 0 : $topid;
			$beedit = $this->fun->accept('beedit', 'P');

			$beistemplatesedit = $this->fun->accept('beistemplatesedit', 'P');
			$db_where = 'tid=' . $tid;

			if ($inputupid > 0 && $upid != $inputupid) {

				$topid_temp = $this->get_type($upid);

				if ($topid_temp['topid'] == 0) {
					$newtopid = $topid_temp['tid'];
				} else {
					$newtopid = $topid_temp['topid'];
				}

				if ($newtopid != $topid) {
					$topid = $newtopid;
					$db_where2 = $this->get_typeid($tid, 'tid', $tid, $mid, 0, $lng);
					if ($db_where2) {
						$db_set = "topid=$topid";
						$this->db->query('UPDATE ' . $db_table . ' SET ' . $db_set . ' WHERE ' . $db_where2);
					}
				}
			}
			$db_set = "topid=$topid,upid=$upid,typename='$typename',content='$content',keywords='$keywords',description='$description',typepic='$typepic',width=$width,height=$height,purview=$purview,ismenu=$ismenu,isaccessory=$isaccessory,ispart=$ispart,styleid=$styleid,pageclass=$pageclass,template='$template',readtemplate='$readtemplate',filenamestyle='$filenamestyle',readnamestyle='$readnamestyle',typeurl='$typeurl',isdatadir=$isdatadir";
			$this->db->query('UPDATE ' . $db_table . ' SET ' . $db_set . ' WHERE ' . $db_where);
			if ($beedit) {
				$db_where2 = $this->get_typeid($tid, 'tid', $tid, $mid, 0, $lng);
				if ($db_where2) {
					$db_set = null;
					if ($beistemplatesedit) {
						$db_set = "template='$template',readtemplate='$readtemplate',";
					}
					$db_set.= "typepic='$typepic',width=$width,height=$height,pageclass=$pageclass,filenamestyle='$filenamestyle',readnamestyle='$readnamestyle'";
					$this->db->query('UPDATE ' . $db_table . ' SET ' . $db_set . ' WHERE ' . $db_where2);
				}
			}
			$this->writelog($this->lng['typemanage_edit_log'], $this->lng['log_extra_ok'] . ' typename=' . $typename . ' tid=' . $tid);
			$this->dbcache->clearcache('typelist_view_' . $tid, true);
			$this->dbcache->clearcache('typelist_array_' . $lng, true);
			if ($lng == $this->CON['is_lancode']) {
				$this->dbcache->clearcache('typelist_array_big5', true);
			}
			exit('true');
		} elseif ($inputclass == 'shift') {
			$this->powercheck(71, 98);
			$tid = $this->fun->accept('tid', 'P');
			$shifttid = $this->fun->accept('shifttid', 'P');

			if ($shifttid == $tid || $shifttid == 0) exit('false');
			$isshift = $this->fun->accept('isshift', 'P');
			$db_table_dc = db_prefix . 'document';
			if ($isshift) {
				$db_where = $this->get_typeid($tid, 'tid', 0, $mid, 0, $lng);
			} else {
				$db_where = "tid=$tid";
			}
			$db_set = "tid=$shifttid";
			$this->db->query('UPDATE ' . $db_table_dc . ' SET ' . $db_set . ' WHERE ' . $db_where);
			$this->writelog($this->lng['typemanage_shift_log'], $this->lng['log_extra_ok'] . ' old_tid=' . $tid . ' newtid=' . $isshift);
			exit('true');
		}
	}

	function ondeltype() {
		$this->powercheck(71, 97);

		$db_table = db_prefix . 'typelist';

		$db_table2 = db_prefix . 'document';

		$db_table3 = db_prefix . 'document_album';

		$db_table4 = db_prefix . 'document_content';

		$db_table5 = db_prefix . 'document_other';

		$db_table6 = db_prefix . 'document_value';
		$tid = $this->fun->accept('tid', 'R');
		if (empty($tid)) exit('false');

		$typeread = $this->get_type($tid);
		$mid = $typeread['mid'];
		$lng = $typeread['lng'];
		$db_where = $this->get_typeid($tid, 'tid', 0, $mid, 0, $lng);

		$sql = 'SELECT did FROM ' . $db_table2 . ' WHERE ' . $db_where;
		$rs = $this->db->query($sql);
		while ($rsList = $this->db->fetch_assoc($rs)) {
			$db_where_dc = 'did=' . $rsList['did'];

			$this->db->query('DELETE FROM ' . $db_table3 . ' WHERE ' . $db_where_dc);

			$this->db->query('DELETE FROM ' . $db_table4 . ' WHERE ' . $db_where_dc);

			$this->db->query('DELETE FROM ' . $db_table5 . ' WHERE ' . $db_where_dc);

			$this->db->query('DELETE FROM ' . $db_table6 . ' WHERE ' . $db_where_dc);
		}

		$typepath = admin_ROOT . $this->CON['file_htmldir'];
		if (!$this->fun->filemode($typepath)) {
			exit($this->lng['filedir_err'] . '(' . $this->CON['file_htmldir'] . ')');
		}

		$sql = 'SELECT tid,lng,dirpath FROM ' . $db_table . ' WHERE ' . $db_where;
		$rs = $this->db->query($sql);
		while ($rsList = $this->db->fetch_assoc($rs)) {

			if (!empty($rsList['dirpath'])) {
				if ($this->CON['is_alonelng']) {
					$typedir = $typepath . $rsList['dirpath'];
				} else {
					$typedir = $typepath . $rsList['lng'] . '/' . $rsList['dirpath'];
				}
				if (!$this->fun->filemode($typedir)) {
					continue;
				}

				$this->fun->delfile($typedir);
			}
			$this->dbcache->clearcache('typelist_view_' . $rsList['tid'], true);
		}

		$this->db->query('DELETE FROM ' . $db_table2 . ' WHERE ' . $db_where);

		$this->db->query('DELETE FROM ' . $db_table . ' WHERE ' . $db_where);
		$this->writelog($this->lng['typemanage_del_log'], $this->lng['log_extra_ok'] . ' tid=' . $tid);
		$this->dbcache->clearcache('typelist_array', true);
		$this->dbcache->clearcache('typelist_view', true);
		exit('true');
	}

	function onsort() {
		$this->powercheck(71, 99);
		$db_table = db_prefix . 'typelist';
		$id = $this->fun->accept('infoid', 'P');
		$pid = $this->fun->accept('pid', 'P');
		$idArray = explode(',', $id);
		$pidArray = explode(',', $pid);
		foreach ($idArray as $key => $value) {
			if (!empty($value)) {
				$db_where = "tid=$value";
				$pid = intval($pidArray[$key]);
				$db_set = "pid=$pid";
				$this->db->query('UPDATE ' . $db_table . ' SET ' . $db_set . ' WHERE ' . $db_where);
				$this->dbcache->clearcache('typelist_view_' . $value, true);
			}
		}
		$this->writelog($this->lng['typemanage_log_sort'], $this->lng['log_extra_ok']);
		$this->dbcache->clearcache('typelist_array', true);
		exit('true');
	}

	function ontypesetting() {
		$this->powercheck(71, 100);
		$db_table = db_prefix . 'typelist';
		$selectinfoid = $this->fun->accept('selectinfoid', 'P');
		if (empty($selectinfoid)) exit('false');
		$selectinfoid = $selectinfoid . '0';
		$typeid = explode(',', $selectinfoid);

		$value = $this->fun->accept('value', 'P');

		$dbname = $this->fun->accept('dbname', 'P');

		$ch = $this->fun->accept('ch', 'R');
		$ch = empty($ch) ? 0 : $ch;
		$db_set = "$dbname=$value";
		if ($ch == 1) {

			$db_where = "tid IN ( $selectinfoid )";
			$this->db->query('UPDATE ' . $db_table . ' SET ' . $db_set . ' WHERE ' . $db_where);
		} else {

			foreach ($typeid as $tid) {
				if ($tid > 0) {

					$topid_temp = $this->get_type($tid);

					if ($topid_temp['upid'] > 0) {
						$upid = $topid_temp['upid'];

						$upid_isclass = $this->get_type($upid, $dbname);

						if ($value != $upid_isclass && $value == 1) exit('false');
					}
					$mid = $topid_temp['mid'];
					$lng = $topid_temp['lng'];
					$db_where = $this->get_typeid($tid, 'tid', 0, $mid, 0, $lng);
					$this->db->query('UPDATE ' . $db_table . ' SET ' . $db_set . ' WHERE ' . $db_where);
				}
			}
		}
		$this->writelog($this->lng['typemanage_log_istype'], $this->lng['log_extra_ok'] . ' tid=' . $selectinfoid);
		$this->dbcache->clearcache('typelist_', true);
		exit('true');
	}

	function oncheckdirname() {
		$dirname = $this->fun->accept('dirname', 'R');
		$lng = $this->fun->accept('lng', 'R');
		$topid = $this->fun->accept('topid', 'R');
		$upid = $this->fun->accept('upid', 'R');
		if (empty($dirname) || empty($lng)) {
			exit('false');
		}
		if (!preg_match("/^[\w-]+$/i", $dirname)) {
			exit('false');
		}
		$db_table = db_prefix . 'typelist';
		$db_table2 = db_prefix . 'subjectlist';
		if (!$upid) {
			$db_where = " WHERE upid=0 AND dirname='$dirname' AND lng='$lng'";
		} else {
			$db_where = " WHERE topid=$topid AND dirname='$dirname' AND lng='$lng'";
		}
		$countnum = $this->db_numrows($db_table, $db_where);
		if ($countnum > 0) {
			$exportAjax = 'false';
		} else {
			if (!$upid) {
				$db_where2 = " WHERE dirname='$dirname' AND lng='$lng'";
				$countnum = $this->db_numrows($db_table2, $db_where2);
				if ($countnum > 0) {
					$exportAjax = 'false';
				} else {
					$exportAjax = 'true';
				}
			} else {
				$exportAjax = 'true';
			}
		}
		exit($exportAjax);
	}

}
?>